<template>
  <div class="application">
    <div class="application-box" >
      <div class="wgl-box" v-show="activityType == 1">
        <!--按钮-->
        <div class="btns" v-show="currentType=='1'">
          <el-button @click="addData('banner')" type="warning">+添加图片</el-button>
        </div>
        <div class="btns" v-show="currentType=='2'">
          <el-button @click="addData('icon')" type="warning">+添加图标</el-button>
        </div>
        <div class="btns" v-show="currentType=='3'">
          <el-button @click="addIcon()" type="warning">+添加图标</el-button>
        </div>
        <div class="btns" v-show="currentType=='4'">
          <el-button @click="addAnnoData()" type="warning">+添加公告</el-button>
        </div>
        <ul class="tab-nav">
          <li class="tab-nav-item" v-for="(item,index) in tabList" :key="item.id" @click="switchTab(index)">{{item.text}}</li>
          <div class="line" ref='line'></div>
        </ul>
        <!--轮播图-->
        <div class="table-box" v-show="currentType=='1'">
          <el-table :data="bannerList">
            <el-table-column label="预览图" width="400px">
              <template slot-scope="scope">
                <div class="previewImg">
                  <img :src="scope.row.full_image" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column label="客户端类型" prop="platform_type_desc"></el-table-column>
            <el-table-column label="跳转链接" prop="link"></el-table-column>
            <el-table-column label="跳转类型">
              <template slot-scope="scope">
                {{scope.row.jump_type_desc}}
              </template>
            </el-table-column>
            <el-table-column label="操作" width="250px">
              <template slot-scope="scope">
                <div class="control">
                  <el-switch
                    @change="handleChangeDisplay('banner',scope.row)"
                    active-text="显示"
                    inactive-text="隐藏"
                    :active-value="1"
                    :inactive-value="0"
                    v-model="scope.row.is_display"
                    active-color="#3f87f5"
                    inactive-color="#e6e8f5">
                  </el-switch>
                  <span class="spacer"></span>
                  <a class="btn" @click="editBannerImg(scope.row)">编辑</a>
                  <span class="spacer"></span>
                  <a class="btn" @click="delData('banner',scope.row.banner_id)" >删除</a>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="bannerPageChange"
              :current-page.sync="bannerPage"
              :page-sizes="pageSizeArray"
              :page-size="10"
              layout="sizes, prev, pager, next"
              :total="banner_total_count">
            </el-pagination>
          </div>
        </div>
        <el-dialog title="" data-flag="轮播图" :visible.sync="bannerDialog" width="1000px;" :show-close="false">
          <div class="uploadImg-box" v-show="currentType==1 || currentType==2">
            <div v-if="!image" class="uploadImg-tips">
              <div class="add-icon">+</div>
              <div class="des">添加图片</div>
              <input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
            </div>
            <div v-else class="previewImages">
              <img :src="showImage" alt="">
              <div class="change-btn">
                重新上传<input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
              </div>
            </div>
            <div v-show="currentType==='1'" class="tips">750*330</div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">客户端类型</div>
            <el-select style="width: 475px;" v-model="clientType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转类型</div>
            <el-select style="width: 475px;" v-model="jump_type" placeholder="请选择">
              <el-option
                v-for="item in jumpOptions"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">appid</div>
            <input v-model="app_id" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （{{jump_type=='跳转至其他程序'?'必填':'选填'}}）
            </div>
          </div>
          <div class="form-item clearfix" v-show="currentType=='2'">
            <div class="labelName lf">图标名称</div>
            <input v-model="name" type="text" class="lf linkAddressInput" >
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转链接</div>
            <input v-model="link" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （必填）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">排序权重</div>
            <input v-model="sort" type="text" class="lf linkAddressInput" >
            <div class="lf tips">（选填）</div>
          </div>
          <!--轮播图-->
          <span slot="footer" class="dialog-footer" v-show="currentType=='1'">
            <el-button class="elButton" v-show="isEdit" @click="handleClickBanner('edit')" type='primary' >编辑</el-button>
            <el-button class="elButton" v-show="!isEdit" type="primary" @click="handleClickBanner('new')">确 定</el-button>
            <el-button class="elButton" @click="cancel()">取 消</el-button>
          </span>
          <!--首页图标-->
          <span slot="footer" class="dialog-footer" v-show="currentType=='2'">
            <el-button class="elButton" v-show="isEdit" @click="handleClickIcon('首页图标','edit')" type='primary' >编辑</el-button>
            <el-button class="elButton" v-show="!isEdit" type="primary" @click="handleClickIcon('首页图标','new')">确 定</el-button>
            <el-button class="elButton" @click="cancel()">取 消</el-button>
          </span>
        </el-dialog>

        <!--首页图标-->
        <div class="table-box" v-show="currentType=='2'">
          <el-table :data="iconList">
            <el-table-column label="预览图" width="400px">
              <template slot-scope="scope">
                <div class="previewImg">
                  <img :src="scope.row.full_image" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column label="图标名称" prop="name"></el-table-column>
            <el-table-column label="客户端类型" prop="platform_type_desc"></el-table-column>
            <el-table-column label="跳转类型" prop="jump_type_desc"></el-table-column>
            <el-table-column label="跳转链接" prop="link"></el-table-column>
            <el-table-column label="操作" width="250px">
              <template slot-scope="scope">
                <div class="control">
                  <el-switch
                    @change="handleChangeDisplay('icon',scope.row)"
                    active-text="显示"
                    inactive-text="隐藏"
                    :active-value="1"
                    :inactive-value="0"
                    v-model="scope.row.is_display"
                    active-color="#3f87f5"
                    inactive-color="#e6e8f5">
                  </el-switch>
                  <span class="spacer"></span>
                  <a class="btn" @click="editIconImg(scope.row)">编辑</a>
                  <span class="spacer"></span>
                  <a class="btn" @click="delData('icon',scope.row.icon_id)">删除</a>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page.sync="iconPage"
              :page-sizes="pageSizeArray"
              :page-size="10"
              layout="sizes, prev, pager, next"
              :total="icon_total_count">
            </el-pagination>
          </div>
        </div>
        <!--底栏图标-->
        <div class="table-box" v-show="currentType=='3'">
          <el-table :data="iconList">
            <el-table-column label="预览图" width="400px">
              <template slot-scope="scope">
                <div class="previewImg">
                  <img :src="scope.row.full_image" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column label="图标名称" prop="name"></el-table-column>
            <el-table-column label="客户端类型" prop="platform_type_desc"></el-table-column>
            <el-table-column label="跳转类型" prop="jump_type_desc"></el-table-column>
            <el-table-column label="跳转链接" prop="link"></el-table-column>
            <el-table-column label="操作" width="250px">
              <template slot-scope="scope">
                <div class="control">
                  <el-switch
                    @change="handleChangeDisplay('icon',scope.row)"
                    active-text="显示"
                    inactive-text="隐藏"
                    :active-value="1"
                    :inactive-value="0"
                    v-model="scope.row.is_display"
                    active-color="#3f87f5"
                    inactive-color="#e6e8f5">
                  </el-switch>
                  <span class="spacer"></span>
                  <a class="btn" @click="editIconImg2(scope.row)">编辑</a>
                  <span class="spacer"></span>
                  <a class="btn" @click="delData('icon',scope.row.icon_id)">删除</a>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page.sync="iconPage"
              :page-sizes="pageSizeArray"
              :page-size="10"
              layout="sizes, prev, pager, next"
              :total="icon_total_count">
            </el-pagination>
          </div>
        </div>

        <el-dialog title="首页图标\底栏图标" data-flag="首页图标\底栏图标" :visible.sync="iconDialog" width="1000px;" :show-close="false">
          <div class="form-item clearfix">
            <div class="labelName lf">选中前状态</div>
            <div class="uploadImg-box lf" style="margin:0;">
              <div v-if="!image" class="uploadImg-tips">
                <div class="add-icon">+</div>
                <div class="des">添加图片</div>
                <input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
              </div>
              <div v-else class="previewImages">
                <img :src="showImage" alt="">
                <div class="change-btn">
                  重新上传<input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
                </div>
              </div>
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">选中后状态</div>
            <div class="uploadImg-box lf" style="margin:0;">
              <div v-if="!after_image" class="uploadImg-tips">
                <div class="add-icon">+</div>
                <div class="des">添加图片</div>
                <input type="file" class="uploadInputFile" @click="uploadImg($event,2)">
              </div>
              <div v-else class="previewImages">
                <img :src="show_after_image" alt="">
                <div class="change-btn">
                  重新上传<input type="file" class="uploadInputFile" @click="uploadImg($event,2)">
                </div>
              </div>
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">客户端类型</div>
            <el-select style="width: 475px;" v-model="clientType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转链接</div>
            <input v-model="link" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （必填）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转类型</div>
            <el-select style="width: 475px;" v-model="jump_type" placeholder="请选择">
              <el-option
                v-for="item in jumpOptions"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">图标名称</div>
            <input v-model="name" type="text" class="lf linkAddressInput" >
          </div>
          <span slot="footer" class="dialog-footer">
          <!--活动 + 底栏-->
          <el-button class="elButton" v-show="isEdit" @click="handleClickIcon('底栏图标','edit')" type='primary' >编辑</el-button>
          <el-button class="elButton" v-show="!isEdit" type="primary" @click="handleClickIcon('底栏图标','new')">确 定</el-button>
          <el-button class="elButton" @click="cancelIcon()">取 消</el-button>
        </span>
        </el-dialog>

        <!--公告通知-->
        <div class="table-box" v-show="currentType=='4'">
          <el-table :data="iconList">
            <el-table-column label="缩略图" width="400px">
              <template slot-scope="scope">
                <div class="previewImg">
                  <img :src="scope.row.full_image" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column label="标题" prop="title"></el-table-column>
            <el-table-column label="描述" prop="description"></el-table-column>
            <el-table-column label="跳转链接" prop="link"></el-table-column>
            <el-table-column label="跳转类型" prop="jump_type_desc"></el-table-column>
            <el-table-column label="操作" width="250px">
              <template slot-scope="scope">
                <div class="control">
                  <el-switch
                    @change="handleAnnoDisplay(scope.row)"
                    active-text="显示"
                    inactive-text="隐藏"
                    :active-value="1"
                    :inactive-value="0"
                    v-model="scope.row.is_display"
                    active-color="#3f87f5"
                    inactive-color="#e6e8f5">
                  </el-switch>
                  <span class="spacer"></span>
                  <a class="btn" @click="editAnno(scope.row)">编辑</a>
                  <span class="spacer"></span>
                  <a class="btn" @click="delAnno(scope.row.notice_id)">删除</a>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleAnnoPageChange"
              :current-page.sync="currentPage"
              :page-sizes="pageSizeArray"
              :page-size="10"
              layout="sizes, prev, pager, next"
              :total="icon_total_count">
            </el-pagination>
          </div>
        </div>
        <el-dialog title="公告通知" data-flag="公告通知" :visible.sync="announcementVisible" width="1000px;" :show-close="false">
          <div class="uploadImg-box" v-show="currentType=='4'">
            <div v-if="!image" class="uploadImg-tips">
              <div class="add-icon">+</div>
              <div class="des">添加图片</div>
              <input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
            </div>
            <div v-else class="previewImages">
              <img :src="showImage" alt="">
              <div class="change-btn">
                重新上传<input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
              </div>
            </div>
          </div>

          <div class="form-item clearfix">
            <div class="labelName lf">标题：</div>
            <input v-model="title" type="text" class="lf linkAddressInput" maxlength="20">
          </div>

          <div class="form-item clearfix">
            <div class="labelName lf">描述：</div>
            <input v-model="description" type="text" class="lf linkAddressInput" maxlength="40">
          </div>

          <div class="form-item clearfix">
            <div class="labelName lf">客户端类型</div>
            <el-select style="width: 475px;" v-model="clientType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转链接</div>
            <input v-model="link" type="text" class="lf linkAddressInput" >
            <div class="lf tips">（选填）</div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转类型</div>
            <el-select style="width: 475px;" v-model="jump_type" placeholder="请选择">
              <el-option
                v-for="item in jumpOptions"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">appid</div>
            <input v-model="app_id" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （{{jump_type=='跳转至其他程序'?'必填':'选填'}}）
            </div>
          </div>
          <div class="form-item clearfix" v-show="currentType=='2'">
            <div class="labelName lf">图标名称</div>
            <input v-model="name" type="text" class="lf linkAddressInput" >
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">排序权重</div>
            <input v-model="sort" type="text" class="lf linkAddressInput" >
            <!--<div class="lf tips">（选填）</div>-->
          </div>
          <span slot="footer" class="dialog-footer" v-show="currentType=='4'">
          <el-button class="elButton" v-show="isEdit" @click="handleClickAnno('edit')" type='primary' >编辑</el-button>
          <el-button class="elButton" v-show="!isEdit" type="primary" @click="handleClickAnno('new')">新增</el-button>
          <el-button class="elButton" @click="cancelAnno()">取 消</el-button>
        </span>
        </el-dialog>
     </div>
     <div class="wgxq-box" v-show="activityType == 2">
            <!--按钮-->
        <div class="btns" v-show="wgxqCurrentType == 1">
          <el-button @click="addBanner" type="warning">+添加轮播图</el-button>
        </div>
        <div class="btns" v-show="wgxqCurrentType == 2">
          <el-button @click="addApplication" type="warning">+添加应用图</el-button>
        </div>
        <ul class="tab-nav">
          <li class="tab-nav-item" v-for="(item,index) in wgxqTabList" :key="item.id" @click="wgxqSwitchTab(index)">{{item.text}}</li>
          <div class="wgxq-line" ref='wgxqLine'></div>
        </ul>
        <!--轮播图-->
        <div class="table-box" v-show="wgxqCurrentType==1">
          <el-table :data="bannerList">
            <el-table-column label="预览图" width="400px">
              <template slot-scope="scope">
                <div class="previewImg">
                  <img :src="scope.row.full_image" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column label="客户端类型" prop="platform_type_desc"></el-table-column>
            <el-table-column label="跳转链接" prop="link"></el-table-column>
            <el-table-column label="跳转类型">
              <template slot-scope="scope">
                {{scope.row.jump_type_desc}}
              </template>
            </el-table-column>
            <el-table-column label="操作" width="250px">
              <template slot-scope="scope">
                <div class="control">
                  <el-switch
                    @change="handleChangeDisplay('banner',scope.row,'wgxq')"
                    active-text="显示"
                    inactive-text="隐藏"
                    :active-value="1"
                    :inactive-value="0"
                    v-model="scope.row.is_display"
                    active-color="#3f87f5"
                    inactive-color="#e6e8f5">
                  </el-switch>
                  <span class="spacer"></span>
                  <a class="btn" @click="editBannerImg(scope.row,'wgxq')">编辑</a>
                  <span class="spacer"></span>
                  <a class="btn" @click="delData('banner',scope.row.banner_id,'wgxq')" >删除</a>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="bannerPageChange"
              :current-page.sync="bannerPage"
              :page-sizes="pageSizeArray"
              :page-size="10"
              layout="sizes, prev, pager, next"
              :total="banner_total_count">
            </el-pagination>
          </div>
        </div>
        <el-dialog title="添加轮播图" data-flag="轮播图" :visible.sync="wgxqBannerDialog" width="1000px;" :show-close="false" >
          <div class="uploadImg-box">
            <div v-if="!image" class="uploadImg-tips">
              <div class="add-icon">+</div>
              <div class="des">添加图片</div>
              <input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
            </div>
            <div v-else class="previewImages">
              <img :src="showImage" alt="">
              <div class="change-btn">
                重新上传<input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
              </div>
            </div>
            <div v-show="currentType==='1'" class="tips">750*330</div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">客户端类型</div>
            <el-select style="width: 475px;" v-model="clientType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转类型</div>
            <el-select style="width: 475px;" v-model="jump_type" placeholder="请选择">
              <el-option
                v-for="item in jumpOptions"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">appid</div>
            <input v-model="app_id" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （{{jump_type=='跳转至其他程序'?'必填':'选填'}}）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转链接</div>
            <input v-model="link" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （必填）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">排序权重</div>
            <input v-model="sort" type="text" class="lf linkAddressInput" >
            <div class="lf tips">（选填）</div>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button class="elButton" v-show="isEdit" @click="handleClickBanner('edit','wgxq')" type='primary'>编辑</el-button>
            <el-button class="elButton" v-show="!isEdit" type="primary" @click="handleClickBanner('new','wgxq')">确 定</el-button>
            <el-button class="elButton" @click="cancel('wgxq')">取 消</el-button>
          </span>
        </el-dialog>
         <!-- 应用图 -->
        <div class="table-box" v-show="wgxqCurrentType==2">
          <el-table :data="applicationList">
            <el-table-column label="背景" width="400px">
              <template slot-scope="scope">
                <div class="previewImg">
                  <img :src="scope.row.full_image" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column label="名称" prop="name"></el-table-column>
            <el-table-column label="简介" prop="description"></el-table-column>
            <el-table-column label="应用类型" prop="platform_type_desc"></el-table-column>
            <el-table-column label="跳转链接" prop="link"></el-table-column>
            <el-table-column label="跳转类型" prop="jump_type_desc"></el-table-column>
            <el-table-column label="操作" width="250px">
              <template slot-scope="scope">
                <div class="control">
                  <el-switch
                    @change="handleChangeDisplay('app',scope.row,'wgxq')"
                    active-text="显示"
                    inactive-text="隐藏"
                    :active-value="1"
                    :inactive-value="0"
                    v-model="scope.row.is_display"
                    active-color="#3f87f5"
                    inactive-color="#e6e8f5">
                  </el-switch>
                  <span class="spacer"></span>
                  <a class="btn" @click="editapp(scope.row)">编辑</a>
                  <span class="spacer"></span>
                  <a class="btn" @click="delApp(scope.row.id)">删除</a>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleAppPageChange"
              :current-page.sync="currentPage"
              :page-sizes="pageSizeArray"
              :page-size="10"
              layout="sizes, prev, pager, next"
              :total="application_total_count">
            </el-pagination>
          </div>
        </div>
        <el-dialog title="添加应用图" data-flag="应用图" :visible.sync="appDialog" width="1000px;" :show-close="false" @close='cancelAnno("wgxq")'>
          <div class="uploadImg-box">
            <div v-if="!image" class="uploadImg-tips">
              <div class="add-icon">+</div>
              <div class="des">添加图片</div>
              <input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
            </div>
            <div v-else class="previewImages">
              <img :src="showImage" alt="">
              <div class="change-btn">
                重新上传<input type="file" class="uploadInputFile" @click="uploadImg($event,1)">
              </div>
            </div>
            <div class="tips">750*330</div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">名称</div>
            <input v-model="title" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （必填）
            </div>
          </div> 
          <div class="form-item clearfix">
            <div class="labelName lf">简介</div>
            <input v-model="description" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （必填）
            </div>
          </div>                     
          <div class="form-item clearfix">
            <div class="labelName lf">应用类型</div>
              <el-select style="width: 475px;" v-model="clientType" placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.label">
                </el-option>
              </el-select>
            <div class="tips" style="display:inline-block">
              （选填）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">appid</div>
            <input v-model="app_id" type="text" class="lf linkAddressInput" >
            <div class="lf tips">必填</div>
          </div>          
          <div class="form-item clearfix">
            <div class="labelName lf">跳转类型</div>
            <el-select style="width: 475px;" v-model="jump_type" placeholder="请选择">
              <el-option
                v-for="item in jumpOptions"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
            <div class="tips" style="display:inline-block">
              （选填）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">跳转链接</div>
            <input v-model="link" type="text" class="lf linkAddressInput" >
            <div class="lf tips">
              （选填）
            </div>
          </div>
          <div class="form-item clearfix">
            <div class="labelName lf">排序权重</div>
            <input v-model="sort" type="text" class="lf linkAddressInput" >
            <div class="lf tips">（选填）</div>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button class="elButton" v-show="isEdit" @click="handleClickApplica('edit','wgxq')" type='primary' >编辑</el-button>
            <el-button class="elButton" v-show="!isEdit" type="primary" @click="handleClickApplica('new')">确 定</el-button>
            <el-button class="elButton" @click="cancelAnno('wgxq')">取 消</el-button>
          </span>
        </el-dialog>
     </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "application",
  components: {},
  data() {
    return {
      show_after_image: "",
      after_image: "",
      iconDialog: false,
      appDialog: false,
      wgxqBannerDialog: false,
      name: "", //图标名称
      currentId: "",
      iconVisible: false,
      is_display: 0, //banner图是否显示或隐藏
      bannerPage: 1, //banner图列表
      isEdit: false, //记录是否编辑的状态
      link: "",
      clientType: "",
      app_id: "", //app_id
      options: [
        {
          label: "小程序",
          value: "0"
        },
        {
          label: "Wap",
          value: "1"
        },
        {
          label: "IOS",
          value: "2"
        },
        {
          label: "Android",
          value: "3"
        }
      ],
      jump_type: "", //跳转的类型
      jumpOptions: [
        {
          label: "内部跳转",
          value: "0"
        },
        {
          label: "外部链接跳转",
          value: "1"
        },
        {
          label: "跳转至其他程序",
          value: "2"
        }
      ],
      sort: "",
      showImage: "",
      image: "",
      currentType: "1",
      banner_total_count: 0,
      icon_total_count: 0,
      app_total_count: 0,
      iconPage: 1,
      bannerDialog: false,
      bannerList: [], //图片列表
      iconList: [], //图标列表
      applicationList: [], //应用图数组
      announcementVisible: false, //公告通知编辑框
      currentPage: 1,
      per_page: 10,
      pageSizeArray: PageSizeArray,
      title: "",
      description: "",
      activityType: 1,
      intro: "",
      application_total_count: 0,
      tabList: [
        {
          id: 1,
          text: "轮播图"
        },
        {
          id: 2,
          text: "首页图标"
        },
        {
          id: 3,
          text: "低栏图标"
        },
        {
          id: 4,
          text: "公告通知"
        }
      ],
      wgxqTabList: [
        {
          id: 1,
          text: "轮播图"
        },
        {
          id: 2,
          text: "应用图"
        }
      ],
      wgxqCurrentType: 1
    };
  },
  methods: {
    //分页 内容切换
    handleCurrentChange(page) {
      this.iconPage = page;
    },

    //分页 每页条数切换 和点击类型判断
    handleSizeChange(data) {
      this.per_page = data;
      //根据路由判断，请求哪类型的数据
      this.currentType = this.$route.params.type;
      switch (this.currentType) {
        case "1":
          this.getBannerList();
          break;
        case "2":
          this.getIconList(0);
          break;
        case "3":
          this.getIconList(1);
          break;
        case "4":
          this.getAnnoList();
          break;
      }
    },

    //轮播图 切换类型
    handleClickChangeType(data) {
      // this.currentType = data.type;
      // this.$router.push({
      //   name: "application",
      //   params: {
      //     type: data.type
      //   }
      // });
    },

    //轮播图 获取列表
    getBannerList() {
      // 需要多一个参数判断平台,0是玩购啦 2是玩购星球
      // activityType 1是玩购啦，2是玩购星球
      let platType = this.activityType == 1 ? 0 : 2;
      let formData = new FormData();
      formData.append("page", this.bannerPage);
      formData.append("per_page", this.per_page);
      formData.append("backend_type", platType);
      this.$http(
        "/wgl_admin/index.php?app=image&act=index",
        "post",
        {},
        {},
        formData,
        success => {
          console.log(success);
          this.bannerList = success.data.list;
          this.banner_total_count = success.data.total_count;
        },
        error => {
          this.$message.error(error.state.msg);
        }
      );
    },

    //新增轮播图、首页图标 图片
    addData(type) {
      this.bannerDialog = true; //轮播图\首页图标
      this.isEdit = false;
      this.showImage = "";
      this.sort = "";
      this.link = "";
      this.image = "";
      this.currentId = "";
      this.clientType = "";
      this.name = "";
      this.app_id = "";
      this.jump_type = "";
    },

    //轮播图 提交和编辑
    handleClickBanner(way, data) {
      let reqArr = [
        ["image", "string", "请上传图片"],
        ["clientType", "string", "请选择平台类型"],
        ["jump_type", "string", "请选择跳转类型"],
        ["link", "string", "请输入跳转链接"]
      ];
      if (this.jump_type === "跳转至其他程序") {
        reqArr.push(["app_id", "string", "请输入app_id"]);
        // reqArr.push(["sort", "string", "请输入排序比例"]);
        // if (!this.app_id) {
        //   this.$message.error("请填写appId");
        //   return;
        // }
      }
      let res = this.$requiredFun(reqArr, this);

      console.log(res.state);

      if (res.state) {
        let formData = new FormData();
        let url = "";
        //判断操作类型
        way === "new"
          ? (url = "/wgl_admin/index.php?app=image&act=add")
          : (url = "/wgl_admin/index.php?app=image&act=edit");
        if (way === "edit") {
          formData.append("id", this.currentId);
        }
        data === "wgxq"
          ? formData.append("backend_type", 2)
          : formData.append("backend_type", 0);
        let jump_type;
        switch (this.jump_type) {
          case "内部跳转":
            jump_type = "0";
            break;
          case "外部链接跳转":
            jump_type = "1";
            break;
          case "跳转至其他程序":
            jump_type = "2";
            break;
        }
        let platform_type;
        switch (this.clientType) {
          case "小程序":
            platform_type = "0";
            break;
          case "Wap":
            platform_type = "1";
            break;
          case "IOS":
            platform_type = "2";
            break;
          case "Android":
            platform_type = "3";
            break;
        }
        formData.append("jump_type", jump_type || "0");
        formData.append("app_id", this.app_id);
        formData.append("platform_type", platform_type);
        formData.append("image", this.image);
        formData.append("link", this.link || "");
        formData.append("is_display", way === "new" ? 0 : this.is_display);
        formData.append("sort", this.sort);
        this.$http(
          url,
          "post",
          {},
          {},
          formData,
          success => {
            this.getBannerList();
            this.$message.success(success.state.msg);
            data === "wgxq"
              ? (this.wgxqBannerDialog = false)
              : (this.bannerDialog = false);

            if (way === "edit") {
              this.isEdit = false;
            }
          },
          error => {
            this.$message.error(error.state.msg);
          }
        );
      } else {
        this.$message.error(res.msg);
      }
    },

    //轮播图 底部图标等判断和 删除,data字段是判断平台
    delData(type, targetId, data) {
      //点击提示是否确定退出登录
      this.$confirm("是否确定删除该轮播图", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          let url = "";
          type === "banner"
            ? (url = "/wgl_admin/index.php?app=image&act=drop")
            : (url = "/wgl_admin/index.php?app=icon&act=drop");
          let formData = new FormData();
          formData.append("id", targetId);
          data === "wgxq"
            ? formData.append("backend_type", 2)
            : formData.append("backend_type", 0);

          this.$http(
            url,
            "post",
            {},
            {},
            formData,
            success => {
              this.$message.success(success.state.msg);
              if (type === "banner") {
                for (let i in this.bannerList) {
                  if (this.bannerList[i].banner_id === targetId) {
                    this.bannerList.splice(i, 1);
                  }
                }
              } else {
                for (let i in this.iconList) {
                  if (this.iconList[i].icon_id === targetId) {
                    this.iconList.splice(i, 1);
                  }
                }
              }
            },
            error => {
              this.$message.error(error.state.msg);
            }
          );
        })
        .catch(() => {});
    },

    //轮播图 分页 切换
    bannerPageChange(page) {
      this.bannerPage = page;
      this.getBannerList();
    },

    //轮播图 修改
    editBannerImg(row, data) {
      if (data == "wgxq") {
        this.wgxqBannerDialog = true;
      } else {
        this.bannerDialog = true;
      }
      this.isEdit = true;
      this.showImage = row.full_image;
      this.image = row.image;
      this.link = row.link;
      this.sort = row.sort;
      this.clientType = row.platform_type_desc;
      this.jump_type = row.jump_type_desc;
      this.currentId = row.banner_id;
      this.app_id = row.app_id;
    },

    //轮播图 图片 应用图片等判断和 切换显示隐藏 这里也需要判断平台
    handleChangeDisplay(type, row, data) {
      var url = "";
      var id = "";
      if (type == "banner") {
        url = "/wgl_admin/index.php?app=image&act=edit";
        id = row.banner_id;
      } else if (type == "icon") {
        url = "/wgl_admin/index.php?app=icon&act=edit";
        id = row.icon_id;
      } else if (type == "app") {
        url = "/wgl_admin/index.php?app=app&act=edit";
        id = row.id;
      }
      var formData = new FormData();
      formData.append("id", id);
      formData.append("is_display", row.is_display);
      // data === "wgxq"
      //   ? formData.append("backend_type", 2)
      //   : formData.append("backend_type", 0);
      this.$http(
        url,
        "post",
        {},
        {},
        formData,
        success => {
          this.$message.success("修改成功");
        },
        error => {
          this.$message.error(error.state.msg);
        }
      );
    },

    //图标 取消
    cancelIcon() {
      this.isEdit = false;
      this.currentId = "";
      this.clientType = "";
      this.name = "";
      this.iconDialog = false;
      this.after_image = "";
      this.show_after_image = "";
      this.show_after_image = "";
      this.image = "";
      this.showImage = "";
      this.link = "";
      this.is_display = 0;
      this.jump_type = "";
    },

    //图标 新增
    addIcon() {
      this.iconDialog = true; //底栏图标
      this.isEdit = false;
      this.currentId = "";
      this.clientType = "";
      this.name = "";
      this.image = "";
      this.showImage = "";
      this.after_image = "";
      this.show_after_image = "";
      this.is_display = 0;
      this.jump_type = "";
      this.link = "";
    },

    //修改图标图片
    editIconImg(row) {
      this.isEdit = true;
      this.currentId = row.icon_id;
      this.name = row.name;
      this.after_image = row.after_image;
      this.is_display = row.is_display;
      this.showImage = row.full_image;
      this.image = row.image;
      this.link = row.link;
      this.sort = row.sort;
      this.clientType = row.platform_type_desc;
      this.jump_type = row.jump_type_desc;
      this.app_id = row.app_id;
      this.bannerDialog = true;
    },

    //修改图标图片
    editIconImg2(row) {
      this.isEdit = true;
      this.currentId = row.icon_id;
      this.clientType = row.platform_type_desc;
      this.name = row.name;
      this.image = row.image;
      this.showImage = row.full_image;
      this.after_image = row.after_image;
      this.show_after_image = row.full_after_image;
      this.link = row.link;
      this.iconDialog = true;
      this.is_display = row.is_display;
      this.jump_type = row.jump_type_desc;
    },

    //首页图标/底栏图标 的编辑判断
    handleClickIcon(type, way) {
      let reqArr, url;
      way === "new"
        ? (url = "/wgl_admin/index.php?app=icon&act=add")
        : (url = "/wgl_admin/index.php?app=icon&act=edit");
      if (type === "首页图标") {
        reqArr = [
          ["image", "string", "请上传图片"],
          ["clientType", "string", "请选择客户端类型"],
          ["jump_type", "string", "请选择跳转类型"],
          ["link", "string", "请输入跳转链接"],
          ["name", "string", "请输入名称"]
        ];
      } else {
        reqArr = [
          ["image", "string", "请上传选中前图片"],
          ["after_image", "string", "请上传选中后图片"],
          ["clientType", "string", "请选择平台类型"],
          ["name", "string", "请输入名称"]
        ];
      }
      let res = this.$requiredFun(reqArr, this);
      if (res.state) {
        let formData = new FormData();
        if (way === "edit") {
          formData.append("id", this.currentId);
        }
        formData.append("name", this.name);

        if (type === "首页图标") {
          let jump_type;
          switch (this.jump_type) {
            case "内部跳转":
              jump_type = "0";
              break;
            case "外部链接跳转":
              jump_type = "1";
              break;
            case "跳转至其他程序":
              jump_type = "2";
              break;
          }
          formData.append("jump_type", jump_type);
          formData.append("app_id", this.app_id);
          formData.append("sort", Number(this.sort));
          formData.append("link", this.link);
        } else if (type === "底栏图标") {
          let jump_type;
          switch (this.jump_type) {
            case "内部跳转":
              jump_type = "0";
              break;
            case "外部链接跳转":
              jump_type = "1";
              break;
            case "跳转至其他程序":
              jump_type = "2";
              break;
          }
          formData.append("jump_type", jump_type);
          formData.append("app_id", this.app_id);
          formData.append("sort", Number(this.sort));
          formData.append("link", this.link);
          formData.append("after_image", this.after_image);
        } else {
          formData.append("after_image", this.after_image);
        }
        let platform_type;
        switch (this.clientType) {
          case "小程序":
            platform_type = "0";
            break;
          case "Wap":
            platform_type = "1";
            break;
          case "IOS":
            platform_type = "2";
            break;
          default:
            platform_type = "3";
            break;
        }
        formData.append("platform_type", platform_type);
        formData.append("image", this.image);
        formData.append("is_display", way === "new" ? 0 : this.is_display);
        switch (this.currentType) {
          case "2":
            formData.append("position_type", 0);
            break;
          case "3":
            formData.append("position_type", 1);
            break;
        }
        this.$http(
          url,
          "post",
          {},
          {},
          formData,
          success => {
            if (type === "首页图标") {
              this.bannerDialog = false;
              this.getIconList(0);
            } else if (type === "底栏图标") {
              this.getIconList(1);
              this.iconDialog = false;
            }
            this.$message.success(success.state.msg);
            if (way === "edit") {
              this.isEdit = false;
            }
          },
          error => {
            this.$message.error(error.state.msg);
          }
        );
      } else {
        this.$message.error(res.msg);
      }
    },

    //点击确定上传图片
    uploadImg(e, type) {
      const currentDOM = e.target;
      //清空files
      currentDOM.value = "";
      let self = this;
      function readFile() {
        let image = this.files[0];
        let formData = new FormData();
        if (this.currentType === "1") {
          formData.append("belong", 6);
        } else {
          formData.append("belong", 7);
        }
        formData.append("image", image);
        //开始上传图片
        self.$http(
          "/wgl_admin/index.php?app=upload_img",
          "post",
          {},
          {},
          formData,
          success => {
            if (type === 1) {
              self.image = success.data.store_path;
              self.showImage = success.data.file_path;
            } else {
              self.after_image = success.data.store_path;
              self.show_after_image = success.data.file_path;
            }
          },
          error => {
            self.$message.error(error.state.msg);
          }
        );
      }
      currentDOM.addEventListener("change", readFile);
    },

    //获取首页的图标
    getIconList(type) {
      this.$http(
        "/wgl_admin/index.php?app=icon&act=index",
        "get",
        {},
        {
          page: this.currentPage,
          per_page: this.per_page,
          position_type: type
        },
        {},
        success => {
          this.iconList = success.data.list;
          this.icon_total_count = success.data.total_count;
        },
        error => {
          this.$message.error(error.state, msg);
        }
      );
    },

    //公告 修改 (打开窗体)
    editAnno(row) {
      //      console.log(row);
      this.isEdit = true;
      this.currentId = row.notice_id;
      this.clientType = row.platform_type_desc;
      this.jump_type = row.jump_type_desc;
      this.title = row.title;
      this.description = row.description;
      this.is_display = row.is_display;
      this.sort = row.sort;
      this.app_id = row.app_id;
      this.link = row.link;
      this.image = row.image;
      this.showImage = row.full_image;
      this.after_image = row.after_image;
      this.show_after_image = row.full_after_image;
      this.announcementVisible = true;
      this.iconDialog = true;
    },

    //公告 新增 (打开窗体)
    addAnnoData() {
      this.isEdit = false;
      this.jump_type = "";
      this.app_id = "";
      this.title = "";
      this.description = "";
      this.showImage = "";
      this.sort = "";
      this.link = "";
      this.image = "";
      this.currentId = "";
      this.clientType = "";
      this.name = "";
      this.announcementVisible = true; //公告通知
    },

    //公告 取消
    cancelAnno(data) {
      if (data === "wgxq") {
        this.appDialog = false;
      } else {
        this.iconDialog = false;
      }
      this.isEdit = false;
      this.showImage = "";
      this.link = "";
      this.sort = "";
      this.clientType = "";
      this.image = "";
      this.currentId = "";
      this.jump_type = "";
      this.app_id = "";
      this.description = "";
      this.title = "";
      this.announcementVisible = false;
    },

    //公告 删除
    delAnno(notice_id) {
      //点击提示是否确定退出登录
      this.$confirm("是否确定删除公告", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          //console.log(notice_id);
          let url = "/wgl_admin/index.php?app=notice&act=drop";
          let formData = new FormData();
          formData.append("id", parseInt(notice_id));
          this.$http(
            url,
            "post",
            {},
            {},
            formData,
            success => {
              this.$message.success(success.state.msg);
              this.getAnnoList();
            },
            error => {
              this.$message.error(error.state.msg);
            }
          );
        })
        .catch(() => {});
    },

    //公告 分页
    handleAnnoPageChange: function(page) {
      console.log(page);
      this.currentPage = page;
      this.getAnnoList();
    },

    //公告 列表
    getAnnoList() {
      let formData = new FormData();
      formData.append("page", this.currentPage);
      formData.append("per_page", this.per_page);
      this.$http(
        "/wgl_admin/index.php?app=notice&act=index",
        "post",
        {},
        {},
        formData,
        success => {
          success.data.list.forEach((cVal, index, arr) => {
            //            cVal.jump_type_desc.indexOf("外部链接跳转")>=0 ? cVal.jump_type_desc = "外部跳转" : "" ;
          });
          this.iconList = success.data.list;
          this.icon_total_count = success.data.total_count;
        },
        error => {
          this.$message.error(error.state, msg);
        }
      );
    },

    // 通知公告 添加和编辑
    handleClickAnno(way) {
      let reqArr = [
        ["image", "string", "请上传图片"],
        ["title", "string", "请填写标题"],
        ["description", "string", "请填写描述"],
        ["clientType", "string", "请选择客户端类型"],
        ["jump_type", "string", "请选择跳转类型"],
        ["app_id", "string", "请输入app_id"]
      ];
      let res = this.$requiredFun(reqArr, this);
      if (res.state) {
        let formData = new FormData();
        let url = "";
        //判断操作类型
        way === "edit"
          ? (url = "/wgl_admin/index.php?app=notice&act=edit")
          : (url = "/wgl_admin/index.php?app=notice&act=add");
        if (way === "edit") {
          formData.append("id", this.currentId); //判断如果是编辑操作，就传入公告 id
        }
        let jump_type;
        // jump_type 是跳转类型
        switch (this.jump_type) {
          case "内部跳转":
            jump_type = "0";
            break;
          case "外部链接跳转":
            jump_type = "1";
            break;
          case "跳转至其他程序":
            jump_type = "2";
            break;
        }
        let platform_type;
        // clientType 是应用端类型

        switch (this.clientType) {
          case "小程序":
            platform_type = "0";
            break;
          case "Wap":
            platform_type = "1";
            break;
          case "IOS":
            platform_type = "2";
            break;
          case "Android":
            platform_type = "3";
            break;
        }
        formData.append("image", this.image);
        formData.append("title", this.title);
        formData.append("description", this.description);
        formData.append("platform_type", platform_type);
        formData.append("jump_type", jump_type || "0");
        formData.append("app_id", this.app_id);
        formData.append("link", this.link || "");
        formData.append("is_display", this.is_display || 0);
        formData.append("sort", this.sort);
        this.$http(
          url,
          "post",
          {},
          {},
          formData,
          success => {
            this.getAnnoList(); //重新获取公告列表
            this.$message.success(success.state.msg);
            if (way === "edit") {
              this.isEdit = false;
            }
            this.announcementVisible = false;
            this.$message.success(success.state.msg);
          },
          error => {
            this.$message.error(error.state.msg);
          }
        );
      } else {
        this.$message.error(res.msg);
      }
    },

    //切换公告隐藏、显示
    handleAnnoDisplay(row) {
      this.currentId = row.notice_id;
      this.is_display = row.is_display;
      this.clientType = row.platform_type_desc;
      this.jump_type = row.jump_type_desc;
      this.title = row.title;
      this.description = row.description;
      this.sort = row.sort;
      this.app_id = row.app_id;
      this.link = row.link;
      this.image = row.image;
      this.showImage = row.full_image;
      this.after_image = row.after_image;
      this.show_after_image = row.full_after_image;
      this.handleClickAnno("edit");
    },

    //清空所有数据
    cancel(data) {
      if (data === "wgxq") {
        this.wgxqBannerDialog = false;
      } else {
        this.bannerDialog = false;
      }
      this.isEdit = false;
      this.showImage = "";
      this.link = "";
      this.sort = "";
      this.clientType = "";
      this.image = "";
      this.after_image = "";
      this.currentId = "";
      this.jump_type = "";
      this.app_id = "";
      this.is_display = 0;
    },
    // 玩购说切换导航
    switchTab(index) {
      let fIndex = index;
      console.log(fIndex);
      this.$refs.line.style.left = fIndex * 25 + "%";
      this.$refs.line.style.transition = `all 0.3s linear`;
      this.currentType = fIndex + 1;
      switch (this.currentType) {
        case 1:
          this.getBannerList();
          break;
        case 2:
          this.getIconList(0);
          break;
        case 3:
          this.getIconList(1);
          break;
        case 4:
          this.getAnnoList();
          break;
      }
    },
    wgxqSwitchTab(index) {
      let fIndex = index;
      console.log(fIndex);
      this.$refs.wgxqLine.style.left = fIndex * 50 + "%";
      this.$refs.wgxqLine.style.transition = `all 0.3s linear`;
      this.wgxqCurrentType = fIndex + 1;
      switch (this.wgxqCurrentType) {
        case 1:
          this.getBannerList();
          break;
        case 2:
          this.getApplicationList();
          break;
      }
    },
    addApplication() {
      this.appDialog = true;
    },
    addBanner() {
      this.wgxqBannerDialog = true;
    },
    // 应用图 添加和编辑
    handleClickApplica(way) {
      let reqArr = [
        ["image", "string", "请上传图片"],
        ["title", "string", "请填写标题"],
        ["description", "string", "请填写描述"],
        ["app_id", "string", "请输入app_id"]
        // ["clientType", "string", "请选择客户端类型"],
        // ["jump_type", "string", "请选择跳转类型"]
      ];
      // if (this.jump_type === "跳转至其他程序") {
      //   reqArr.push(["app_id", "string", "请输入app_id"]);
      // }
      let res = this.$requiredFun(reqArr, this);
      if (res.state) {
        let formData = new FormData();
        let url = "";
        //判断操作类型
        way === "new"
          ? (url = "/wgl_admin/index.php?app=app&act=add")
          : (url = "/wgl_admin/index.php?app=app&act=edit");
        if (way === "edit") {
          formData.append("id", this.currentId); //判断如果是编辑操作，就传入公告 id
        }
        let jump_type = "";
        switch (this.jump_type) {
          case "内部跳转":
            jump_type = "0";
            break;
          case "外部链接跳转":
            jump_type = "1";
            break;
          case "跳转至其他程序":
            jump_type = "2";
            break;
          default:
            jump_type = "";
            break;
        }
        let platform_type;
        switch (this.clientType) {
          case "小程序":
            platform_type = "0";
            break;
          case "Wap":
            platform_type = "1";
            break;
          case "IOS":
            platform_type = "2";
            break;
          case "Android":
            platform_type = "3";
            break;
        }
        formData.append("image", this.image);
        formData.append("name", this.title);
        formData.append("description", this.description);
        formData.append("platform_type", platform_type || -1);
        formData.append("jump_type", jump_type || "0");
        formData.append("app_id", this.app_id);
        formData.append("link", this.link || "");
        // formData.append("is_display", this.is_display || 0);
        formData.append("sort", this.sort);
        this.$http(
          url,
          "post",
          {},
          {},
          formData,
          success => {
            this.getApplicationList(); //重新应用列表接口
            this.$message.success(success.state.msg);
            if (way === "edit") {
              this.isEdit = false;
            }
            this.appDialog = false;
          },
          error => {
            this.$message.error(error.state.msg);
          }
        );
      } else {
        this.$message.error(res.msg);
      }
    },
    handleAppPageChange(data) {
      this.bannerPage = data;
      this.getApplicationList();
    },
    // 应用图列表接口
    getApplicationList() {
      let formData = new FormData();
      formData.append("page", this.bannerPage);
      formData.append("per_page", this.per_page);
      // let params = {
      // }
      this.$http(
        "/wgl_admin/index.php?app=app&act=index",
        "post",
        {},
        {},
        formData,
        success => {
          console.log(success);
          // success.data.list.map((item) => {

          // })
          this.applicationList = success.data.list;
          this.application_total_count = success.data.total_count;
          console.log(this.application_total_count);
        },
        error => {
          this.$message.error(error.state.msg);
        }
      );
    },
    editapp(row) {
      console.log(row);
      this.appDialog = true;
      this.isEdit = true;
      this.currentId = row.id;
      this.clientType = row.platform_type_desc;
      this.jump_type = row.jump_type_desc;
      this.title = row.name;
      this.description = row.description;
      this.is_display = row.is_display;
      this.sort = row.sort;
      this.app_id = row.app_id;
      this.link = row.link;
      this.image = row.image;
      this.showImage = row.full_image;
      this.after_image = row.after_image;
      this.show_after_image = row.full_after_image;
    },
    delApp(targetId) {
      //点击提示是否确定退出登录
      this.$confirm("是否确定删除该应用图", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          let formData = new FormData();
          formData.append("id", targetId);
          this.$http(
            "/wgl_admin/index.php?app=app&act=drop",
            "post",
            {},
            {},
            formData,
            success => {
              this.$message.success(success.state.msg);
              this.getApplicationList();
            },
            error => {
              this.$message.error(error.state.msg);
            }
          );
        })
        .catch(() => {});
    }
  },
  watch: {
    $route(to, from) {
      this.$nextTick(() => {
        this.activityType = to.params.type;
        switch (to.params.type) {
          case "1":
            this.getBannerList();
            break;
          case "2":
            this.getBannerList();
            break;
        }
      });
    }
  },
  created() {
    this.activityType = this.$route.params.type;
    switch (this.$route.params.type) {
      case "1":
        this.getBannerList();
        break;
      case "2":
        this.getIconList(0);
        break;
      case "3":
        this.getIconList(1);
        break;
      case "4":
        this.getAnnoList();
        break;
    }
  },
  mounted() {}
};
</script>

<style lang="scss" rel="stylesheet/scss"  scoped>
.application {
  position: relative;
  padding-left: 118px;
  .application-box {
    padding: 30px 70px 30px 50px;
    width: 100%;
    .btns {
      min-width: 1446px;
      margin-bottom: 38px;
    }
  }
  .table-box {
    width: 100%;
    // max-width: 1466px;
  }
}
.form-item {
  width: 615px;
  margin: 0 auto 20px;
  color: #666666;
  font-size: 12px;
  .labelName {
    width: 70px;
    text-align: right;
    height: 40px;
    line-height: 40px;
    margin-right: 10px;
  }
  .linkAddressInput {
    height: 40px;
    border: 1px solid #e6e8f4;
    padding: 0 28px;
    margin-right: 10px;
    width: 475px;
    padding: 0 28px;
  }
  .tips {
    height: 40px;
    line-height: 40px;
  }
}

.pagination {
  width: 100%;
  text-align: right;
  margin-top: 46px;
}
.previewImg {
  width: 200px;
  height: 100px;
  margin: 0 auto;
  > img {
    display: block;
    width: 100%;
    height: 100%;
  }
}
.control {
  .btn {
    color: #6499f5;
    font-size: 12px;
    cursor: pointer;
    position: relative;
  }
  .spacer:after {
    content: "|";
    display: inline;
    color: #b7bdc9;
  }
}
.uploadImg-box {
  width: 110px;
  height: 110px;
  border: 1px solid #e6e8f4;
  background: #f8f9fe;
  position: relative;
  margin: 0 auto 50px;
  .uploadImg-tips {
    width: 100%;
    height: 100%;
    .add-icon {
      text-align: center;
      color: #e6e8f7;
      font-size: 40px;
      height: 70px;
      line-height: 70px;
    }
    .des {
      font-size: 14px;
      text-align: center;
      color: #a6a8a5;
    }
  }
  .previewImages {
    display: block;
    width: 100%;
    height: 100%;
    > img {
      display: block;
      height: 100%;
      width: 100%;
    }
    .change-btn {
      position: absolute;
      bottom: 0;
      text-align: center;
      width: 100%;
      background: rgba(0, 0, 0, 0.5);
      color: #fff;
      height: 24px;
      line-height: 24px;
      left: 0;
      cursor: pointer;
      font-size: 12px;
      cursor: pointer;
    }
    .change-btn:hover {
      background: #333;
    }
  }
  .uploadInputFile {
    width: 100%;
    height: 100%;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: pointer;
    z-index: 9999;
    cursor: pointer;
  }
  .tips {
    height: 30px;
    line-height: 30px;
    color: #666;
    text-align: center;
    font-size: 14px;
  }
}
.dialog-footer {
  display: block;
  height: 100%;
  width: 100%;
  padding-top: 18px;
  border-top: 1px solid #e6e8f4;
  .elButton {
    width: 150px;
  }
}
// 导航切换
.tab-nav {
  position: relative;
  display: inline-block;
  height: 40px;
  line-height: 40px;
  margin: 10px 0;
  &-item {
    display: inline-block;
    width: 100px;
    text-align: left;
    &:hover {
      cursor: pointer;
    }
  }
  .line,
  .wgxq-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: #3f87f5;
  }
}
</style>
